package com.xci.sys.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xci.core.domain.BaseEntity;
import com.xci.core.internal.Const;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
 * 系统定时任务日志
 * @author 吕艳阳
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "系统定时任务日志")
public class SysJobLog extends BaseEntity {
	/**
	 * 任务日志主键
	 */
	@ExcelIgnore @Excel(name = "任务日志主键", width = 20d)
	@ApiModelProperty(value = "任务日志主键", required = true, position = 1)
	private String id;

	/**
	 * 任务主键
	 */
	@NotBlank(message = "请输入任务主键")
	@Length(max = 100, message = "任务主键长度不能超过{max}")
	@ExcelIgnore
	@Excel(name = "任务主键", width = 20d)
	@ApiModelProperty(value = "任务主键", required = true, position = 2)
	private String jobId;

	/**
	 * 任务名称
	 */
	@NotBlank(message = "请输入任务名称")
	@Length(max = 100, message = "任务名称长度不能超过{max}")
	@Excel(name = "任务名称", width = 20d)
	@ApiModelProperty(value = "任务名称", required = true, position = 3)
	private String jobName;

	/**
	 * 任务表达式
	 */
	@NotBlank(message = "请输入任务表达式")
	@Length(max = 500, message = "任务表达式长度不能超过{max}")
	@Excel(name = "任务表达式", width = 20d)
	@ApiModelProperty(value = "任务表达式", required = true, position = 4)
	private String jobExpression;

	/**
	 * 任务执行消息
	 */
	@Length(max = 500, message = "任务执行消息长度不能超过{max}")
	@Excel(name = "任务执行消息", width = 20d)
	@ApiModelProperty(value = "任务执行消息", position = 5)
	private String msg;

	/**
	 * 任务执行错误信息
	 */
	@Excel(name = "任务执行错误信息", width = 20d)
	@ApiModelProperty(value = "任务执行错误信息", position = 6)
	private String errorMsg;

	/**
	 * 执行类型 [手动触发_1,系统触发_
	 */
	@NotNull(message = "请输入执行类型 [手动触发_1,系统触发_")
	@Excel(name = "执行类型 [手动触发_1,系统触发_", width = 20d)
	@ApiModelProperty(value = "执行类型 [手动触发_1,系统触发_", required = true, position = 7)
	private Integer triggerCategory;

	/**
	 * 执行状态 [成功_1,失败_0]
	 */
	@NotNull(message = "请输入执行状态")
	@Excel(name = "执行状态", width = 20d, replace = { "成功_1", "失败_0" })
	@ApiModelProperty(value = "执行状态 [成功_1,失败_0]", required = true, position = 8)
	private Boolean status;

	/**
	 * 创建时间
	 */
	@Excel(name = "创建时间", width = 20d, exportFormat = Const.DEFAULT_DATETIME_PATTERN)
	@ApiModelProperty(value = "创建时间", required = true, position = 9)
	private Date operateDateTime;

	/** 开始时间 */
	@ExcelIgnore
	@ApiModelProperty(hidden = true)
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private Date startTime;

	/** 结束时间 */
	@ExcelIgnore
	@ApiModelProperty(hidden = true)
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private Date endTime;
}
